import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 模具维修故障分类信息 */
export interface RepairFaultCategory {
  id: number // 主键
  name?: string // 名称
  code?: string // 编码
  status: number // 状态
  description: string // 描述
}

// 模具维修故障分类 API
export const RepairFaultCategoryApi = {
  // 查询模具维修故障分类分页
  getRepairFaultCategoryPage: async (params: any) => {
    return await request.get({ url: `/mold/repair-fault-category/page`, params })
  },

  // 查询模具维修故障分类详情
  getRepairFaultCategory: async (id: number) => {
    return await request.get({ url: `/mold/repair-fault-category/get?id=` + id })
  },

  // 新增模具维修故障分类
  createRepairFaultCategory: async (data: RepairFaultCategory) => {
    return await request.post({ url: `/mold/repair-fault-category/create`, data })
  },

  // 修改模具维修故障分类
  updateRepairFaultCategory: async (data: RepairFaultCategory) => {
    return await request.put({ url: `/mold/repair-fault-category/update`, data })
  },

  // 删除模具维修故障分类
  deleteRepairFaultCategory: async (id: number) => {
    return await request.delete({ url: `/mold/repair-fault-category/delete?id=` + id })
  },

  /** 批量删除模具维修故障分类 */
  deleteRepairFaultCategoryList: async (ids: number[]) => {
    return await request.delete({
      url: `/mold/repair-fault-category/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出模具维修故障分类 Excel
  exportRepairFaultCategory: async (params) => {
    return await request.download({ url: `/mold/repair-fault-category/export-excel`, params })
  },

  // 查询所有保养类型
  getRepairFaultCategoryAll: async () => {
    return await request.get({ url: `/mold/repair-fault-category/all` })
  }
}
